
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="<?php echo Yii::app()->homeUrl; ?>">Project name</a>
        </div>
        <div class="navbar-collapse collapse">
            <?php
            Yii::beginProfile('navigation-menu');
            $this->widget('zii.widgets.CMenu', array(
                'items' => $this->navigationMenu(array(
                    'parentCaret'=>' <b class="caret"></b>',
                    'parentItemOptions'=>array('class'=>'dropdown'),
                    'parentLinkOptions'=>array(
                        'class'=>'dropdown-toggle',
                        'data-toggle'=>'dropdown',
                    ),
                )),
                'encodeLabel'=>false,
                'activateParents'=>true,
                'htmlOptions' => array('class' => 'nav navbar-nav'),
                'activateParents' => true,
                'activeCssClass' => 'active',
                'submenuHtmlOptions'=>array('class'=>'dropdown-menu'),
            ));
            Yii::endProfile('navigation-menu');
            ?>
        </div>
    </div>
</div>
<?php 
Yii::app()->clientScript->registerScript('navigation-menu','
        $(document).ready(function(){
            $("ul.dropdown-menu [data-toggle=dropdown]").on("click", function(event) {
                    event.preventDefault(); 
                    event.stopPropagation(); 
                    $(this).parent().siblings().removeClass("open");
                    $(this).parent().toggleClass("open");
            });
        });
     ',CClientScript::POS_END);
?>
